package com.example;

import lombok.SneakyThrows;

/**
 * 垃圾回收机制
 *
 * @author Frank
 * @create 2020-12-01 22:25
 **/
public class GCRootDemo {
    private byte[] byteArray = new byte[100 * 1024 * 1024];

    private static GCRootDemo gc2;
    private static final GCRootDemo gc3 = new GCRootDemo();

    public static void m1() {
        GCRootDemo gc1 = new GCRootDemo();
        System.gc();
        System.out.println("第一次GC完成");
    }

    @SneakyThrows
    public static void main(String[] args) {
        m1();
        Thread.sleep(1000000);
    }
}
